
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,  user-scalable=0;" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style"  />
    <meta content="telephone=no" name="format-detection" />
    <link rel="stylesheet" href="${ctx}/static/mobileweb/1/css/common.css?_=${.now?string('yyyy-MM-dd')}">
    <script>
        document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
            WeixinJSBridge.call('hideToolbar');
        });
    </script>
    <title>签到有礼</title>
</head>
<body>
<div class="signBox">
    <p><img src="${ctx}/static/mobileweb/1/images/signgift.png" alt=""/></p>
    <p class="signed">本周已签到<span id="weekCount">${weekCount!}</span>次</p>
    <div class="signshow" id="signshow">
        <#list weekInfos as info>
            <span week="${info.dayYmd!}" <#if info.sign?string("yes", "no") == "yes">class="on"</#if>>${info.weekCn}</span>
        </#list>
        <#--<span class="on">星期一</span>
        <span>星期二</span>
        <span>星期三</span>
        <span>星期四</span><br/>
        <span>星期五</span>
        <span>星期六</span>
        <span>星期日</span>-->
    </div>
    <p class="ruleTitle">每日签到规则</p>
    <div class="signRule">
        ${game.description!}
        <#--每日签到领取5个中南币（连续领取，每日增加5个，封顶为20个）-->
        <#if today.sign?string("yes", "no") == "yes">
            <p class="nowsign mt15 tright" signed="signed"><a href="javascript:void(0);">已签到</a></p>
        <#else>
            <p class="nowsign mt15 tright" id="sign" signed="" week="${today.dayYmd!}"><a href="javascript:void(0);">立即签到</a></p>
        </#if>

    </div>
</div>
</body>
<script type="text/javascript" src="${ctx}/static/mobileweb/scripts/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(function() {
    $("#sign").click(function() {
        var _this = this;
        var signed = $(_this).attr("signed")
        if (!signed) {
            $.post("${ctx}/mobileweb/game/sign" , {'mid' : '${mid}', 'gid' : '${gid}'}, function(data) {
                if(data.status == 'OK') {
                    var cur = $("#weekCount").html();
                    $("#weekCount").html(parseInt(cur) + 1);
                    $(_this).attr("signed", "signed");
                    $(_this).find("a").html("已签到");
                    $("#signshow").find("span[week='"+ $(_this).attr("week") +"']").addClass("on");
                }
            });
        }
    });
});
</script>
</html>
